﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
             xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
             xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:SoftSource_Resources="clr-namespace:SoftSource.Resources;assembly=SoftSourceResources"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:softsourceConverters="clr-namespace:SoftSource.Common.Converters;assembly=SoftSource.Common.Silverlight"
             x:Class="SoftSource.Timecard.Entry.Root"
             mc:Ignorable="d"
             d:DesignWidth="500"
             d:DesignHeight="343">

    <UserControl.Resources>
        <softsourceConverters:ObjectToVisibilityConverter x:Key="ObjectToVisibilityConverter" />
    </UserControl.Resources>

    <Grid Style="{StaticResource LayoutRootGridStyle}">

        <SoftSource_Resources:Master x:Name="MasterPage"
                                     ContactBarVisibility="Collapsed"
                                     ApplicationName="{Binding ApplicationStrings.ApplicationName, Source={StaticResource ResourceWrapper}}">
            <SoftSource_Resources:Master.InfoBarContent>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <StackPanel Margin="6,2,0,2"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Orientation="Horizontal">
                        <StackPanel VerticalAlignment="Center"
                                    Orientation="Horizontal">
                            <TextBlock Text="Version " />
                            <TextBlock Text="{Binding Source={StaticResource WebContext}, Converter={StaticResource ObjectToExecutingAssemblyVersionConverter}}" />
                        </StackPanel>
                    </StackPanel>
                    <StackPanel HorizontalAlignment="Right"
                                Orientation="Horizontal"
                                Grid.Column="1">
                        <StackPanel VerticalAlignment="Center"
                                    Orientation="Horizontal"
                                    Margin="0,0,10,0"
                                    Visibility="{Binding User.FullName, Source={StaticResource WebContext}, Converter={StaticResource ObjectToVisibilityConverter}}">
                            <TextBlock Text="Logged in as: " />
                            <TextBlock Text="{Binding User.FullName, Source={StaticResource WebContext}, Mode=OneWay}" />
                        </StackPanel>
                        <Grid Margin="0,0,10,0">
                            <HyperlinkButton Content="Administration"
                                             VerticalAlignment="Center"
                                             Click="AdministrationLink_Click"
                                             Visibility="{Binding User.FullName, Source={StaticResource WebContext}, Converter={StaticResource RoleToVisibilityConverter}}"
                                             Style="{StaticResource SimpleHyperlinkButtonStyle}" />
                        </Grid>
                        <Grid>
                            <HyperlinkButton Click="Login_Click"
                                             Content="Login"
                                             VerticalAlignment="Center"
                                             Margin="0,0,10,0"
                                             Visibility="{Binding User.FullName, Source={StaticResource WebContext}, Converter={StaticResource ObjectToVisibilityConverter}, ConverterParameter=True}"
                                             Style="{StaticResource SimpleHyperlinkButtonStyle}" />
                            <HyperlinkButton Click="Logoff_Click"
                                             Content="Logoff"
                                             VerticalAlignment="Center"
                                             Margin="0,0,10,0"
                                             Visibility="{Binding User.FullName, Source={StaticResource WebContext}, Converter={StaticResource ObjectToVisibilityConverter}}"
                                             Style="{StaticResource SimpleHyperlinkButtonStyle}" />
                        </Grid>
                    </StackPanel>
                </Grid>
            </SoftSource_Resources:Master.InfoBarContent>
        </SoftSource_Resources:Master>
    </Grid>
</UserControl>